ODBCdisconnect | ODBCgetResult |
Syntax: @ODBCexecSQL Connection_Handle, Command [, error_flag]
This command sends an SQL command to a database that you have connected to via 'ODBC'.
Connection Handle: This is the Connection handle returned from a previous use of the @ODBCconnect command.
Command: This is any valid SQL statement to be executed.
Error Flag: An optional numeric variable name can be included, which will return zero for successful execution and non zero otherwise.
Examples
@ODBCexecSQL ConnectionNo,'SELECT * FROM "Main_Table"'
@ODBCexecSQL DBhandle,'SELECT "Age" FROM "Main_Table" WHERE "Name" = '''+SelectedName+''''
In this example SelectedName is a variable.
A handy way of developing the correct syntax for your own SQL statements is by creating a Query in Microsoft Access and viewing the resulting SQL command (View - SQL). The Access SQL is a slightly different dialect to ODBC SQL, but in the main all you need to do is change the use of any double quote character to a single quote character in the resulting statement.
For information on SQL commands, refer to the documentation provided with your SQL system.